package com.lhhu.demo.config;

import com.lhhu.demo.interceptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Auther 虎
 * @Data 2020/3/12 16:24
 * @Version 1.0
 */
@Configuration   //声明为一个配置类，使spring扫描自动读取内容
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //设置拦截路径，当前是拦截所有
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/xadd**");
    }
}
